package com.twu.biblioteca.ui.menus.items.movies;

import com.twu.biblioteca.library.Library;
import com.twu.biblioteca.ui.menus.AbstractMenu;
import com.twu.biblioteca.ui.menus.items.AbstractMenuItem;
import com.twu.biblioteca.ui.menus.movies.ListMoviesMenu;
import com.twu.biblioteca.ui.menus.movies.NoAvailableMoviesMenu;

/**
 * @author Alvi Jonathan Sait
 */
public class ListMoviesMenuItem extends AbstractMenuItem {

    public ListMoviesMenuItem() {
        super("List Movies");
    }

    @Override
    public AbstractMenu handleAction(Library library) {
        if (library.getMovies().isEmpty()) {
            return new NoAvailableMoviesMenu(library);
        }
        return new ListMoviesMenu(library);
    }
}
